Compares two strings and returns an integer value that represents the result of the comparison.
2 つの文字列を比較して、その結果を示す数値を返します。
StrComp (Text1 As String, Text2 As String[, Compare])
StrComp (Text1 As String, Text2 As String[, Compare])
Integer
整数
Text1: Any string expression
Text1: 任意の文字列表式。
Text2: Any string expression
Text2: 任意の文字列表式。
Compare: This optional parameter sets the comparison method. If Compare = 1, the string comparison is case-sensitive. If Compare = 0, no distinction is made between uppercase and lowercase letters.
Compare: 比較モードを指定する数値表式 (省略可)。Compare に 1 を指定すると、大文字と小文字を区別した比較が行われます。Compare に 0 を指定すると、大文字と小文字を区別せずに比較が行われます。
If Text1 < Text2 the function returns -1
Text1 < Text2 の場合、関数の戻り値には -1 が返されます。
If Text1 = Text2 the function returns 0
Text1 = Text2 の場合、関数の戻り値には 0 が返されます。
If Text1 > Text2 the function returns 1
Text1 > Text2 の場合、関数の戻り値には 1 が返されます。
Sub ExampleStrComp
Sub ExampleStrComp
Dim iVar As Single
Dim iVar As Single
Dim sVar As String
Dim sVar As String
iVar = 123.123
iVar = 123.123
sVar = Str$(iVar)
sVar = Str$(iVar)
Msgbox strcomp(sVar , Str$(iVar),1)
Msgbox strcomp(sVar , Str$(iVar),1)
end sub
end sub